This is a r file to show what the phenotypess are after 1000 generations

A problem that I have been experiencing is that the phenotypes seem so go wild really quickly. One species’ phenotype balloons to be really high while the other species" phenotype stays really low.

This will be a graph that looks at the phenotypes of different simulations with a unique mutation rate and mutation effect size.

Lets just visualize what the phenotypes are doing.

The testing Paramiters

I used different values for snake_mu_effect_sd newt_mu_effect_sd snake_mu_rate newt_mu_rate. I chose these parameters to see if there would be a seeable interaction in phenotypes Other params: sigma_i = 1, recomb=1e-8, sigma_in = 0.5, sigma_M = 0.33, SD=SI=surs=SM=sigma_in, L = 4, W=35.0, G=1e8, FECUN = 1/(L), RHO, FECUN/((1+FECUN) * K), interaction_rate = 0.05, PE = 0.1, w= 10, c = 0.0, initializeRecombinationRate(recomb), initializeMutationRate(1e-10), initializeGenomicElement(g1, 0, G-1)

Other things: (kind of confusing)
initializeMutationType(“m1”, 0.5, “n”, 0, newt_mu_effect_sd); initializeMutationType(“m2”, 0.5, “n”, 0, snake_mu_effect_sd); initializeGenomicElementType(“g1”, c(m1, m2), c(newt_mu_rate/mu_rate, 1)); // mutation proportions add the proportion (the target mutation rate)

Snake/newt mu effect sd -> is the standard deviation that each mutation would “effect” a phenotype. Values: 0.01 0.05 0.2 0.5

Snake/newt mu rate -> is the mutation rate that were assigned to newts and snakes. Values: 1.00E-08 1.00E-10 1.00E-12

In total there were 144 combinations. One simulation per combination (this experiment was not repeated)

Project future goal as of summer 2021

My summer 2021 goal is to get the 1 on 1 simulation to run correctly. For this to happen I would like the simulation to have: -Realistic phenotypes (snake 0-3, newt 0-1.5(thoughts 2021?)) -See if the levels of toxicity and resistance interact -See groups of mutations/ certain phenotypes

Mistake Simulations

I tried to run SLiM simulation different with the selected parameters and the MSprime both_su_1e-10_nu_1e-10_sue_0.01_nue_0.01 (s/n u mutation rate, n/s ue mutation effect size). However I flipped the mutation rate and effect size. So… new experiment with really large mutation rate and small effect size????

Makeing of the Figure

Loop through the files and find the max and min of each of the species phenotypes Then set up a graph with the average phenotype

This section of code loops though the files and finds the maximum and minumum pheotypes of newts and snakes. and make two lines (red for newts blue for snakes) and keep a minimum about of info in mem at a time

## [1] "Newt max pheno: 1.11929"
## [1] "Snake max phenot: 1.08395"
## [1] "Newt min pheno: 0"
## [1] "Snake min Pheno: 0.914673"

This section of code loops though the files and make two lines (red for newts blue for snakes). This figure shows how the pheotypes change over 1000 generations. It also keeps a minimum about of info in memory at a time. aka dont open all of the files and put it into a large dataframe.

## Difference between snake and newt pheotypes

This figure represents the difference between the snake and the newt phenotype. The pick lines indicat that the newt is more toxit than the snakes, while the blue line indicates that the snakes are more resitant than the newts

How much did the phenotypes of newts and snakes change over 1000 generations

For this figure I want there to be 2 sets of points (4 complete points) for each simulation taking the first and last mean phenotype for the newt and the snake. Essentially, asking if the phenotypes of the newts and snakes changed over 1000 generations?

Trasforming the phenotypes back

I want to see what the un-transformed phentypes are and compare them to their transformed buddies to figure out what values I should be using for sigma and mu.

I calculated the phenotypes from this expression, newt pheno = exp(inds_n.sumOfMutationsOfType(m1)/10). So to un-transform and find the # of mutations I need to ln both sides of the equation ln(pheno=e^(sumOfMutations/10)). Then solve for sumOfMutations, sumOfMutations = 10 * ln(pheno)

Notes: difference in the trees betw two chromosomes in a pop of size N is 4N so # of differing mutations is like 4 N L mu where L = genome length, mu = mutaiton rate per bp and if each mutation has an effect size that is N(0, sd=sigma), then the sum of K of these has mean 0 and SD= sigma * sqrt(K). So untransformed phenotypes (sum of effect sizes) should have mean 0 and SD= sigma * sqrt(4 N L mu). So, you’d work out what SD you want, then given mu solve for sigma (the SD of effect size)

The Correct Experiment

I ran 144 SLiM simulations with different parameters values and used the MSprime both_su_1e-10_nu_1e-10_sue_0.01_nue_0.01 (s/n u mutation rate, n/s ue mutation effect size) file.

Again I looped through the files and find the max and min of each of the species pheotypes Then set up a graph with the average pheotypes over 1000 generations (red line for newts blue linesfor snakes).

This is the correct one:

## [1] "Newt max pheno: 1.93225"
## [1] "Snake max phenot: 1.99304"
## [1] "Newt min pheno: 0"
## [1] "Snake min Pheno: 0"

## Difference between snake and newt pheotypes

## How much did the phenotypes of newts and snakes change over 1000 generations

Trasforming the phenotypes back

Expanded Experiment 2sims:

This time I examine what the SLIM script would generate is both the MSprime and SLIM are ran with the variables that I picked. I ran 144 SLiM simulations & MSprime with different parameters values.

Again I looped through the files and find the max and min of each of the species pheotypes Then set up a graph with the average phenotypes over 1000 generations (red line for newts blue lines for snakes).

## [1] "Newt max pheno: 2.02937e+40"
## [1] "Snake max phenot: 0"
## [1] "Min pheno dif: -2.78729e+15"
## [1] "Max Pheno dif: 5.20424e+42"

some of these values are in quotes, why?

Difference between snake and newt pheotypes

## Warning in trans$transform(limits): NaNs produced
## Warning in self$trans$transform(x): NaNs produced
## Warning: Transformation introduced infinite values in continuous y-axis
## Warning: Removed 50 row(s) containing missing values (geom_path).

## How much did the phenotypes of newts and snakes change over 1000 generations

Trasforming the phenotypes back

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion

## Warning in FUN(X[[i]], ...): NAs introduced by coercion
## Warning: Removed 14 row(s) containing missing values (geom_path).
## Warning: Removed 27 row(s) containing missing values (geom_path).
## Warning: Removed 28 row(s) containing missing values (geom_path).
## Warning: Removed 34 row(s) containing missing values (geom_path).
## Warning: Removed 21 row(s) containing missing values (geom_path).
## Warning: Removed 19 row(s) containing missing values (geom_path).
## Warning: Removed 28 row(s) containing missing values (geom_path).
## Warning: Removed 2 row(s) containing missing values (geom_path).
## Warning: Removed 34 row(s) containing missing values (geom_path).
## Warning: Removed 23 row(s) containing missing values (geom_path).
## Warning: Removed 39 row(s) containing missing values (geom_path).
## Warning: Removed 35 row(s) containing missing values (geom_path).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 6 row(s) containing missing values (geom_path).
## Warning: Removed 38 row(s) containing missing values (geom_path).
## Warning: Removed 9 row(s) containing missing values (geom_path).
## Warning: Removed 10 row(s) containing missing values (geom_path).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 14 row(s) containing missing values (geom_path).
## Warning: Removed 11 row(s) containing missing values (geom_path).
## Warning: Removed 14 row(s) containing missing values (geom_path).